package chixing.day07.inherited;

//打折的商品
public class DiscountProduct extends Product{
    private float discountRate;//折扣率

    //构造函数constructor

    public DiscountProduct(){
        super();//默认调用父类的无参构造
    }
    public DiscountProduct(float discountRate) {
        super();//默认调用
        this.discountRate = discountRate;
    }

    public DiscountProduct(int proNo, String proName, float proPrice, float discountRate) {
        super(proNo, proName, proPrice);
        this.discountRate = discountRate;
    }


    public void fun1(){
        System.out.println(super.getProName());
        System.out.println(super.getProPrice());
        System.out.println(this.getProName());

    }


    //get，set方法
    public float getDiscountRate() {
        return discountRate;
    }

    public void setDiscountRate(float discountRate) {
        this.discountRate = discountRate;
    }

    //tostring方法
    @Override
    public String toString() {
//        return  super.toString() + "DiscountProduct{" + "discountRate=" + discountRate + '}';
        return  "productName = " + this.getProName() + ",  price = " + this.getProPrice() + ",  discountRate = " + this.discountRate ;

    }
}
